<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>按键修饰符</title>
</head>

<body>

    <div class="box">
        <div>
            用户名：<input type="text" v-model='uname' @keyup.delete='del'>
        </div>
        <div>
            密码：<input type="password" v-model='password' @keyup.enter='handle'>
        </div>

    </div>
    <script src="./js/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '.box',
            data: {
                uname: '',
                password: ''
            },
            methods: {
                handle() {
                    console.log(this.uname, this.password)
                },
                del() {
                    this.uname = ''
                }
            }
        })
    </script>
</body>

</html>